package com.itheima.activities.rabbitmq;

import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.annotation.Exchange;
import org.springframework.amqp.rabbit.annotation.Queue;
import org.springframework.amqp.rabbit.annotation.QueueBinding;
import org.springframework.amqp.rabbit.annotation.RabbitListener;

/**
 * @author :wujunjie
 * createTime :2022-12-20 19:21
 * description :
 */
//@Component
@Slf4j
public class Mylistener {

    @RabbitListener(
        bindings = @QueueBinding(
                value = @Queue("queue1.direct"),
                exchange = @Exchange("queue.direct"),
                key = {"itcast"}
        )
    )
    public void  listener1(String msg){
        log.info("队列msg1:{}",msg);
    }

    @RabbitListener(
            bindings = @QueueBinding(
                    value = @Queue("queue2.direct"),
                    exchange = @Exchange("queue.direct"),
                    key = {"itcast"}
            )
    )
    public void  listener2(String msg){
        log.info("队列msg2:{}",msg);
    }

    @RabbitListener(
            bindings = @QueueBinding(
                    value = @Queue("queue3.direct"),
                    exchange = @Exchange("queue2.direct"),
                    key = {"itcast"}
            )
    )
    public void  listener3(String msg){
        log.info("队列msg3:{}",msg);
    }
    @RabbitListener(
            bindings = @QueueBinding(
                    value = @Queue("queue3.direct"),
                    exchange = @Exchange("queue2.direct"),
                    key = {"itcast"}
            )
    )
    public void  listener4(String msg){
        log.info("队列msg4:{}",msg);
    }
}
